<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看任务</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../public/layui/css/layui.css">
    <script src="../public/jquery-1.12.4.js"></script>
    <link rel="icon" href="../homepage/img/logo.png">
    <link rel="stylesheet" href="../public/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../public/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../public/public.css" media="all">
    <link rel="stylesheet" href="../css/head.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/bootstrap-3.3.4.css">
    <link rel="stylesheet" href="../css/reset.css"/>
    <style>
        .layui-btn{
            background-color: #86a0f3;
            color: white;
        }
        .layui-laypage .layui-laypage-curr .layui-laypage-em {
            background-color: #86a0f3;
        }
        .layui-bg-green {
            background-color: #86a0f3 !important;
        }
        .content1{
            width: 100%;height:80px
        }
        #derive{
            padding-top: 10px;
            padding-left: 20px;
        }
    </style>
</head>
<body>
<!-- 导航 -->
<header class="header">
    <div class="container clearfix">
        <div class="fl left">
            <a href="javascript:void(0)"><img src="../homepage/img/logo.png" alt="" class="img1"/></a>
            <a href="javascript:void(0)" id="one">辅导员智慧工作平台</a>
        </div>
        <div class="fr nav">
            <ul class="navbar_nav" data-in="fadeInDown" data-out="fadeOutUp">
                <li class="active">
                    <a href="../homepage/homepage.html">首页</a>
                </li>
                <li class="dropdown">
                    <a href="javascript:void(0)">任务管理</a>
                    <div class="dropdown_menu">
                        <a href="../work-add/work-add.html">定制任务</a>
                        <a href="#">查看任务</a>
                    </div>
                </li>
                <li class="dropdown">
                    <a href="javascript:void(0)">培训管理</a>
                    <div class="dropdown_menu">
                        <a href="#">我的培训</a>
                        <a href="#">培训管理</a>
                    </div>
                </li>
                <li>
                    <a href="javascript:void(0)">文件库</a>
                </li>
                <li>
                    <a href="javascript:void(0)">网络公告</a>
                </li>
                <li>
                    <a href="javascript:void(0)">档案管理</a>
                </li>
            </ul>
        </div>
        <a href="javascript:void(0)" id="navToggle">
            <span></span>
        </a>
    </div>
</header>
<div class="layuimini-container" style="margin-top: 60px">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label"style="width: 100px;">事务标题:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" id="title" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">开始日:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="start"  name="start" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">截止日:</label>
                            <div class="layui-input-inline">
                                <input type="text" id="end" name="end" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
            </div>
        </fieldset>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter">

        </table>

        <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="look">查看</a>
        </script>

    </div>
</div>


<script src="../public/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table','laydate','laypage'], function () {
        var $ = layui.jquery,
            form = layui.form,
            laypage=layui.laypage,
                table = layui.table;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#start' //指定元素
        });
        laydate.render({
            elem: '#end' //指定元素
        });
        table.render({
            elem: '#currentTableId',
            //url: '../api/table2.1.json',
            url:'/Counselor_System/manage/tasks',
            toolbar: 'true',//头部工具栏
            height:500,//表格高度
            cols: [[
                {type: "checkbox", width: 50},
                {field: 'id', width: 130, title: '事务ID', sort: true},
                {field: 'title', width: 250, title: '事务标题'},
                {field: 'type', width: 150, title: '事务类型'},
                {field: 'task', width: 150, title: '事务分类'},
                {field: 'createTime', width: 200, title: '发布时间', sort: true},
                {field: 'finishTime', width: 200, title: '截止时间', sort: true},
                {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
            ]],
            skin: 'row '//设定表格各种外观、尺寸等
            ,id: 'tableAll'//设定容器唯一 id。
            ,page: true//开启分页
            , limits: [10, 15, 20]  //一页选择显示3,5或10条数据
            , limit: 10 //一页显示6条数据
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据，res为从url中get到的数据
                var result;
                // console.log(this);
                // console.log(JSON.stringify(res));
                if (this.page.curr) {
                    result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
                }
                else {
                    result = res.data.slice(0, this.limit);
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.count, //解析数据长度
                    "data": result //解析数据列表
                };
            }
        });

        //数据表格的重载
        $('.layui-btn').click(function () {
            table.reload('tableAll', {
                //url: '../api/table2.1search.json'//向后台发送请求
                    url:'/Counselor_System/manage/searchTaskByParam'
                ,methods:"post"
                ,where: {
                    title :$('#title').val(),//搜索条件
                    start:$('#start').val(),
                    end:$('#end').val()
                }
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        })


        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });

        //查看
        table.on('tool(currentTableFilter)', function (obj) {
            // console.log(obj.data)

            var id = obj.data.id;
            $.ajax({
                //点查看后去先存查到的数据
                //传id
                url:'/Counselor_System/manage/users',
                //type:'GET',
                dataType:'json',
                data:{
                    id:id
                },
                success:function (res) {
                    console.log(res);
                    console.log("成功！！！")

                },
                error:function (res) {
                    console.log(res);
                    console.log("失败！！！")
                }
            })

                if (obj.event === 'look') {
                    var index = layer.open({
                        title: '查看详情',
                        type: 2,//层类型：2（iframe层）
                        shade: 0.2,//遮罩
                        maxmin:true,//最大最小化。
                        shadeClose: true,//是否点击遮罩关闭
                        area: ['80%', '80%'],//宽高
                        content: 'look.html',
                    });
                    $(window).on("resize", function () {
                        layer.full(index);
                    });
                    //return false;
                }





        });



    });
</script>

</body>
</html>